;====================================================================
; Project:     The Suspect 
; Version:     0.1
; Author:      Marco Sessa
; Email:       marcosessa@gmail.com
; Copyright:   Zarkosoft
; Description: 
;              13 July 2011     
;                   
;====================================================================
Type player
  Field id
  Field name$
  Field isMale
  Field isWhite
  Field hairColor
  Field hairLenght
  Field eyesColor
  Field hasMustache
  Field hasSideburns
  Field hasEarring
  Field hasGlasses
  Field hasHat
  Field hasNeo
  Field hasNecklace
  Field hasPitOnTheChin
End Type

;====================================================================
; Color constants
;====================================================================
Const black  = 0
Const white  = 1
Const green  = 2
Const red    = 3
Const blue   = 4
Const brown  = 5
Const purple = 6
Const blond  = 7
Const grey   = 8
Const lightBrown = 9

;====================================================================
; Hair constants
;====================================================================
Const shortHair = 0
Const longHair  = 1
Const noHair    = -1

;====================================================================
; Sex constants
;====================================================================
Const female = 0
Const male   = 1

;====================================================================
; Skin constants
;====================================================================
Const blackSkin = 0
Const whiteSkin = 1

;====================================================================
; Boolean constants
;====================================================================
Const no  = 0
Const yes = 1


.Characters
;id,nome,sesso,col Pelle,col capelli,tipo capelli,col occhi,pizzetto/baffi,basette,orecchino,occhiali,cappello,neo,collana,pit on the chin
Data 1,"Rebecca",0,1,6,1,2,0,0,0,0,0,1,1,0
Data 2,"Mario",1,1,5,0,0,1,1,0,1,0,0,0,0
Data 3,"Marta",0,1,3,1,4,0,0,0,0,0,0,0,0
Data 4,"Elton",1,1,3,0,0,1,0,0,1,1,0,0,0
Data 5,"Claudio",1,1,9,1,0,1,1,0,1,0,0,1,0
Data 6,"Stefan",1,1,7,0,0,1,0,0,0,0,0,0,0
Data 7,"Ciruzzo",1,1,3,0,2,1,0,0,0,0,0,0,1
Data 8,"Max",1,1,0,0,0,1,0,1,0,0,0,1,1
Data 9,"Vince",1,0,1,1,4,1,1,1,0,0,1,1,0
Data 10,"Manolo",1,1,0,0,0,0,0,0,1,0,0,0,0
Data 11,"Glauco",1,1,0,-1,4,0,1,0,0,0,0,1,0
Data 12,"Simona",0,1,3,1,0,0,0,1,0,0,0,0,0
Data 13,"Giorgia",0,0,5,0,4,0,0,1,0,0,1,0,0
Data 14,"Karina",0,0,0,1,0,0,0,0,0,0,1,0,0
Data 15,"Paola",0,1,0,1,0,0,0,0,0,0,0,0,0
Data 16,"Erika",0,1,6,1,4,0,0,1,0,0,0,0,0
Data 17,"Jack",1,1,7,1,0,1,0,0,0,1,0,0,0
Data 18,"Eddie",1,0,0,0,0,1,0,0,1,0,0,0,0
Data 19,"Rodrigo",1,1,8,0,0,1,0,0,0,0,0,0,0
Data 20,"Ramona",0,1,0,1,4,0,0,0,0,0,0,1,0
Data 21,"Marco",1,1,7,0,2,1,1,0,0,0,0,0,0
Data 22,"Rosy",0,1,1,0,0,0,0,1,1,0,0,1,0
Data 23,"Patricia",0,0,5,0,0,0,0,1,0,0,0,1,0
Data 24,"Carl",1,1,7,0,4,1,0,0,0,0,0,0,0
Data 25,"Sergio",1,1,5,0,0,0,0,0,0,0,0,0,0
Data 26,"Renato",1,1,1,1,0,0,0,0,0,0,1,1,0
Data 27,"Gino",1,1,0,-1,2,0,0,0,0,0,0,0,0
Data 28,"Giuseppe",1,1,7,1,4,0,0,0,0,0,0,0,1
Data 29,"Monique",0,1,0,1,2,0,0,1,0,0,1,0,0
Data 30,"Anna",0,1,7,1,2,0,0,1,0,0,0,0,0
Data 31,"John",1,1,0,1,4,0,0,0,0,0,0,0,0
Data 32,"Federico",1,1,0,0,0,0,0,0,1,0,0,1,0
Data 33,"Al",1,1,0,0,0,0,0,0,1,0,0,0,0
Data 34,"senzaNome",0,0,0,-1,2,0,0,0,0,0,0,0,0
Data 35,"Fujiko",0,1,0,1,0,0,0,0,0,0,0,0,0
Data 36,"Albert",1,1,1,1,0,1,1,0,1,1,0,0,0

Const maxChars      = 30 ;36
Global removedChars = 0
Const maxAttributes = 15

;players is a matrix that contains all the characters and their attributes.
Dim players$(maxChars, maxAttributes)


;====================================================================
; Global Images
;====================================================================

Global charImg1 = LoadImage("people\1.jpg")
Global charImg2 = LoadImage("people\2.jpg")
Global charImg3 = LoadImage("people\3.jpg")
Global charImg4 = LoadImage("people\4.jpg")
Global charImg5 = LoadImage("people\5.jpg")
Global charImg6 = LoadImage("people\6.jpg")
Global charImg7 = LoadImage("people\7.jpg")
Global charImg8 = LoadImage("people\8.jpg")
Global charImg9 = LoadImage("people\9.jpg")
Global charImg10 = LoadImage("people\10.jpg")
Global charImg11 = LoadImage("people\11.jpg")
Global charImg12 = LoadImage("people\12.jpg")
Global charImg13 = LoadImage("people\13.jpg")
Global charImg14 = LoadImage("people\14.jpg")
Global charImg15 = LoadImage("people\15.jpg")
Global charImg16 = LoadImage("people\16.jpg")
Global charImg17 = LoadImage("people\17.jpg")
Global charImg18 = LoadImage("people\18.jpg")
Global charImg19 = LoadImage("people\19.jpg")
Global charImg20 = LoadImage("people\20.jpg")
Global charImg21 = LoadImage("people\21.jpg")
Global charImg22 = LoadImage("people\22.jpg")
Global charImg23 = LoadImage("people\23.jpg")
Global charImg24 = LoadImage("people\24.jpg")
Global charImg25 = LoadImage("people\25.jpg")
Global charImg26 = LoadImage("people\26.jpg")
Global charImg27 = LoadImage("people\27.jpg")
Global charImg28 = LoadImage("people\28.jpg")
Global charImg29 = LoadImage("people\29.jpg")
Global charImg30 = LoadImage("people\30.jpg")

;mainArrays is a matrix that contains for each record the image and the id of the character.
Dim mainArray$(30,2)
mainArray(1,1)  = charImg1
mainArray(2,1)  = charImg2
mainArray(3,1)  = charImg3
mainArray(4,1)  = charImg4
mainArray(5,1)  = charImg5
mainArray(6,1)  = charImg6
mainArray(7,1)  = charImg7
mainArray(8,1)  = charImg8
mainArray(9,1)  = charImg9
mainArray(10,1) = charImg10
mainArray(11,1) = charImg11
mainArray(12,1) = charImg12
mainArray(13,1) = charImg13
mainArray(14,1) = charImg14
mainArray(15,1) = charImg15
mainArray(16,1) = charImg16
mainArray(17,1) = charImg17
mainArray(18,1) = charImg18
mainArray(19,1) = charImg19
mainArray(20,1) = charImg20
mainArray(21,1) = charImg21
mainArray(22,1) = charImg22
mainArray(23,1) = charImg23
mainArray(24,1) = charImg24
mainArray(25,1) = charImg25
mainArray(26,1) = charImg26
mainArray(27,1) = charImg27
mainArray(28,1) = charImg28
mainArray(29,1) = charImg29
mainArray(30,1) = charImg30

setScale(ScaleFactor)

;====================================================================
; Functions
;====================================================================
Function setupCharacters()
  Local n
  
  Local id
  Local name$
  Local isMale
  Local isWhite
  Local hairColor
  Local hairLenght
  Local eyesColor
  Local hasMustache
  Local hasSideburns
  Local hasEarring
  Local hasGlasses
  Local hasHat
  Local hasNeo
  Local hasNecklace
  Local hasPitOnTheChin
  
  removedChars = 0
  
  Restore Characters
	For n = 1 To maxChars
    Read id, name$, isMale, isWhite, hairColor, hairLenght, eyesColor, hasMustache, hasSideburns, hasEarring, hasGlasses, hasHat, hasNeo, hasNecklace, hasPitOnTheChin
    players(n, 1) = id
		players(n, 2) = name$
		players(n, 3) = isMale
    players(n, 4) = isWhite
    players(n, 5) = hairColor
    players(n, 6) = hairLenght
    players(n, 7) = eyesColor
    players(n, 8) = hasMustache
    players(n, 9) = hasSideburns
    players(n, 10) = hasEarring 
    players(n, 11) = hasGlasses
    players(n, 12) = hasHat
    players(n, 13) = hasNeo
    players(n, 14) = hasNecklace
    players(n, 15) = hasPitOnTheChin
    
    Local pl.player = New player
    pl\id = id
    pl\name = name$
    pl\isMale = isMale
    pl\isWhite = isWhite
    pl\hairColor =  hairColor
    pl\hairLenght = hairLenght
    pl\eyesColor = eyesColor
    pl\hasMustache = hasMustache
    pl\hasSideburns = hasSideburns
    pl\hasEarring = hasEarring
    pl\hasGlasses = hasGlasses
    pl\hasHat = hasHat
    pl\hasNeo = hasNeo
    pl\hasNecklace =  hasNecklace
    pl\hasPitOnTheChin = hasPitOnTheChin
    
    mainArray(n,2) = id
  Next
  
  ;=========================================================
  ; DEBUG
  ;=========================================================
  ;Local i
  ;For n= 1 To maxChars
  ;  For i = 1 To maxAttributes
  ;    DebugLog "players(" + n+ "," + i + ")" + players(n,i)
  ;  Next
  ;Next
End Function


Function drawPlayers(player_x,player_y)
  Local maxCol = (screen_width / tileSize) - 1
  Local maxRow = (maxChars - removedChars)/maxCol
  ;Local maxCol = screen_width / (tileSize * 2)
  ;Local maxRow = (maxChars - removedChars)/maxCol
  Local i,col, row
  ;For i = 1 To (maxChars - removedChars)
  Local counter = 0
  For pl.player = Each player
;    If maxRow > 0
;      If (((counter) Mod maxRow)=0) 
;        col = col + 1
;        row = 0
;      EndIf
;    EndIf
    If maxCol> 0
      If (((counter) Mod maxCol)=0) 
        col = 0
        row = row + 1
      EndIf
    EndIf
    counter = counter + 1
    ;DrawImage mainArray(i,1),player_x + row * tileSize, player_y + col * tileSize
    DrawImage mainArray(pl\id,1),player_x + (row -1) * tileSize, player_y + (col) * tileSize
    ;row = row + 1
    col = col + 1
    Color 255,255,255
    Text player_x + (row-1) * tileSize, player_y + (col) * tileSize - (tileSize-FontHeight*3), players(mainArray(pl\id,2),2)
    ;DebugLog " - " + mainArray(i,2)
  Next
End Function

Function setScale(scale#)
  Local i
  For i = 1 To maxChars
    ScaleImage mainArray(i,1), scale#, scale#
  Next
End Function



;~IDEal Editor Parameters:
;~C#Blitz3D